/*
 * @Author: daiqisheng 3273889106@qq.com
 * @Date: 2022-11-28 15:39:14
 * @LastEditors: daiqisheng 3273889106@qq.com
 * @LastEditTime: 2023-02-20 09:45:56
 * @FilePath: \vite-demo\vite.config.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import { resolve } from "path";
export default defineConfig({
  plugins: [vue()],
  resolve: {
    alias: {
      "@": resolve(__dirname, "src"),
    },
  },
  base: "./",
  server: {
    port: 4000,
    open: true,
    cors: true,
    host: "0.0.0.0",
    // 设置代理
    proxy: {
      "/api": {
        target: "http://101.43.51.238:8089",
        changeOrigin: true,
        secure: true,
        rewrite: (path) => path.replace("/api", "/"),
      },
    },
  },
  // 授权解决hdr文件
  assetsInclude: ["**/*.hdr", "**/*.glb", "**/*.glsl"],
  css: {
    preprocessorOptions: {
      scss: {
        javascriptEnabled: true,
        additionalData: `@import "./src/assets/scss/global.scss";`, // 配置全局 scss
      },
    },
  },
});